#include <iostream>
#include <string>

int main() {
std::string s;
std::cin >> s;
std::string s1 = "";

for (char c : s) {
    if (c == '(') {
        s1 = s1 + c;
        if (c == '{') {
            s1 = s1 + c;
            if (c == '[') {
                s1 = s1 + c;
                }
            }
        }
if (c == ')') {
    if (s1.length() > 0) {
        if (s1[s1.length() - 1] == '(') {
            s1 = s1.substr(0, s1.length() - 1);
            }
        }
    }
if (c == ']') {
    if (s1.length() > 0) {
        if (s1[s1.length() - 1] == '[') {
            s1 = s1.substr(0, s1.length() - 1);
            }
        }
    }
if (c == '}') {
    if (s1.length() > 0) {
        if (s1[s1.length() - 1] == '{') {
            s1 = s1.substr(0, s1.length() - 1);
            }
        }
    }
}
if (s1.length() == 0)
    { std::cout << "True" << std::endl;}
else
    { std::cout << "False" << std::endl;}

    return 0;
}
